package com.ktmall.controller;

import com.ktmall.pojo.CategoryItem;
import com.ktmall.service.CategoryItemService;
import com.ktmall.utils.RespMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "前台分类数据相关接口")
@RestController
@RequestMapping("/uni/home/category/mutli")
public class CategoryItemController {
    @Autowired
    private CategoryItemService categoryItemService;
    @ApiOperation("查询前台分类列表")
    @RequestMapping("/list")
    public RespMsg getOneLevelCategory(){
        List<CategoryItem> list = categoryItemService.getOneLevelCategory();
        return RespMsg.success("前台分类列表加载成功",list);
    }
    @ApiOperation("查询一级分类列表")
    @RequestMapping("/findAll")
    public RespMsg findAllCategoryList(){
        List<CategoryItem> list = categoryItemService.getCategoryAndGoods();
        return RespMsg.success("一级分类列表加载成功",list);
    }
}
